export default {
  get: (sdk, exportOBJ, allFunc, dependencies) => {
    allFunc.addBinding(exportOBJ.SettingGetCommand, async e => {
      const [t] = await dependencies.getDependencies()
      return t.tryGetProperty(e.key, void 0)
    })
    sdk.addCommandCreator({ namespace: "Settings", name: "get", args: ["key"] }, e => new exportOBJ.SettingGetCommand(e.key))
  },
  update: (sdk, exportOBJ, allFunc, dependencies) => {
    allFunc.addBinding(exportOBJ.SettingUpdateCommand, async e => {
      if (!e.key || "string" != typeof e.key) throw Error("Settings: invalid key")
      const [t] = await dependencies.getDependencies()
      t.updateSetting(e.key, e.value)
      return t.tryGetProperty(e.key, void 0)
    })
    sdk.addCommandCreator({ namespace: "Settings", name: "update", args: ["key", "value"] }, e => new exportOBJ.SettingUpdateCommand(e.key, e.value))
  }
}
